package com.asiainfo.kbisheet.components.condition
{
	import com.asiainfo.kbisheet.components.condition.date.ConditionItemDate;
	import com.asiainfo.kbisheet.components.condition.month.ConditionItemMonth;
	import com.asiainfo.kbisheet.components.condition.ddlist.ConditionItemDDList;

	/**
	 * ConditionItem的工厂类。
	 */
	public class ConditionItemFactory
	{
		public static function create(conditionXML:XML):ConditionItem{
			var conditionItem:ConditionItem;			
			var type:String = conditionXML.@type;
			switch(type){
				case CONDITION_TYPE.DATE:
					conditionItem =  new ConditionItemDate(conditionXML);
					break;
				case CONDITION_TYPE.MONTH:
				case CONDITION_TYPE.MONTH_OLD:
					conditionItem =  new ConditionItemMonth(conditionXML);
					break;
				case CONDITION_TYPE.DDLIST:
					conditionItem = new ConditionItemDDList(conditionXML);
					break;
				default:
					conditionItem = new ConditionItem(conditionXML);
			}
			return conditionItem;
		}
	}
}